﻿<!DOCTYPE html>
<html lang="en">
<head>
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Two grids demo</title>

    <link rel="stylesheet" href="/CSS/bootstrap3.3.5/css/bootstrap.css">
    <link rel="stylesheet" href="/CSS/font-awesome-4.3.0/css/font-awesome.css" />
    <link rel="stylesheet" href="/JqueryPlug/gridstack/dist/gridstack.css" />
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/jqueryui.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
    <script src="/JqueryPlug/gridstack/dist/gridstack.js"></script>

    <style type="text/css">
        #grid1 {
            background: lightgoldenrodyellow;
        }

        #grid2 {
            background: lightcyan;
        }

        .grid-stack-item-content {
            color: #2c3e50;
            text-align: center;
            background-color: #18bc9c;
        }
    </style>
</head>
<body>
    <div class="container-fluid">
        <h1>Two grids demo</h1>

        <div class="row">
            <div class="col-md-6">
                <div class="grid-stack grid-stack-6" id="grid1">
                </div>
            </div>
            <div class="col-md-6">
                <div class="grid-stack grid-stack-6" id="grid2">
                </div>
            </div>
        </div>
    </div>


    <script type="text/javascript">
        $(function () {
            var options = {
                width: 6,
                float: true
            };
            $('#grid1').gridstack(options);
            $('#grid2').gridstack(options);

            var items = [
                {x: 0, y: 0, width: 2, height: 2},
                {x: 3, y: 1, width: 1, height: 2},
                {x: 4, y: 1, width: 1, height: 1},
                {x: 2, y: 3, width: 3, height: 1},
                {x: 2, y: 5, width: 1, height: 1}
            ];

            $('.grid-stack').each(function () {
                var grid = $(this).data('gridstack');

                _.each(items, function (node) {
                    grid.add_widget($('<div><div class="grid-stack-item-content" /><div/>'),
                        node.x, node.y, node.width, node.height);
                }, this);
            });
        });
    </script>
</body>
</html>
